package com.zscat.mallplus.center.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zscat.mallplus.center.BaseController;
import com.zscat.mallplus.center.entity.CenterJifenItem;
import com.zscat.mallplus.center.service.ICenterJifenItemService;
import com.zscat.mallplus.utils.CommonResult;

/**
 * 积分余额明细Controller(作废 备用)
 * 
 * @author Wsen
 * @date 2020-09-24
 */
@RestController
@RequestMapping("/center/jifenItem")
public class CenterJifenItemController extends BaseController
{
    @Autowired
    private ICenterJifenItemService centerJifenItemService;

    /**
     * 查询积分余额明细列表
     */
//    @PreAuthorize("@ss.hasPermi('center:jifenItem:list')")
    @GetMapping("/list")
    public Object list(CenterJifenItem centerJifenItem)
    {
        List<CenterJifenItem> list = centerJifenItemService.selectCenterJifenItemList(centerJifenItem);
        return new CommonResult().success(list);
    }

    /**
     * 获取积分余额明细详细信息
     */
//    @PreAuthorize("@ss.hasPermi('center:jifenItem:query')")
    @GetMapping(value = "/{id}")
    public Object getInfo(@PathVariable("id") Long id)
    {
        return new CommonResult().success(centerJifenItemService.selectCenterJifenItemById(id));
    }

    /**
     * 新增积分余额明细
     */
//    @PreAuthorize("@ss.hasPermi('center:jifenItem:add')")
    @PostMapping
    public Object add(@RequestBody CenterJifenItem centerJifenItem)
    {
        return toAjax(centerJifenItemService.insertCenterJifenItem(centerJifenItem));
    }

    /**
     * 修改积分余额明细
     */
    @PreAuthorize("@ss.hasPermi('center:jifenItem:edit')")
    @PutMapping
    public Object edit(@RequestBody CenterJifenItem centerJifenItem)
    {
        return toAjax(centerJifenItemService.updateCenterJifenItem(centerJifenItem));
    }

    /**
     * 删除积分余额明细
     */
    @PreAuthorize("@ss.hasPermi('center:jifenItem:remove')")
	@DeleteMapping("/{ids}")
    public Object remove(@PathVariable Long[] ids)
    {
        return toAjax(centerJifenItemService.deleteCenterJifenItemByIds(ids));
    }
}
